﻿@{
    ViewBag.Title = "Upload";

    var albumId = Request["albumId"];
    var album = Request["album"];
}

<br />
<br />
<br />
<div class="page-header">
    <h1>Adauga poze in @album</h1>
</div>

<script src="@Url.Content("~/Scripts/core-upload-settings.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/plupload.full.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/jquery.plupload.queue/jquery.plupload.queue.js")" type="text/javascript"></script>
<link href="@Url.Content("~/js/jquery.plupload.queue/css/jquery.plupload.queue.css")" rel="stylesheet" type="text/css" />

<div id="plupload_container" style="height: 340px;">

</div>


<div>
    @Html.ActionLink("Inapoi la Albume", "Albums")
</div>

<script type="text/javascript">
    $(document).ready(function () {

        var upload = $('#plupload_container').pluploadQueue({

            runtimes: 'html5,gears,flash,silverlight,html4',
            url: '@Url.Content("~/Admin/MakeUpload")',
            silverlight_xap_url: '../js/plupload.silverlight.xap',
            flash_swf_url: '../js/plupload.flash.swf',
            max_file_size: '500mb',
            chunk_size: '1mb',
            unique_names: false,
            multiple_queues: true,
            multipart_params: { 'album': @albumId },
            //resize: { width: 1024, height: 800, quality: 90 },
            filters:
            [
                { title: "Image files", extensions: "jpg, jpeg" }
            ],

            preinit: function (uploader) {
                uploader.bind('FileUploaded', function (up, file) {
                    $.post('@Url.Action("thumbnail", "admin")',
                    {
                        uploadedFilename: file.name,
                        albumName: @albumId
                    });

                    up.refresh();
                });
            }
        });
    
    
    });

</script>